{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import seaborn as sns, matplotlib.pyplot as plt, pandas as pd\n",
    "iv = pd.read_csv(\"outputs/iv_us.csv\")\n",
    "risk = pd.read_csv(\"outputs/risk_metrics.csv\")\n",
    "reg = pd.read_csv(\"outputs/reg_results.csv\")  # 由 07_regression.py 保存\n",
    "\n",
    "# 1. 工具变量相关性散点\n",
    "sns.lmplot(data=iv, x=\"IV_US\", y=\"digi_risk\", hue=\"year\", height=5, aspect=1.5)\n",
    "plt.title(\"IV_US vs. Digi_Risk (First-Stage)\")\n",
    "plt.savefig(\"figs/iv_stage1.png\", dpi=300)\n",
    "\n",
    "# 2. 动态效应（事件研究）\n",
    "event = pd.read_csv(\"outputs/event_study.csv\")  # 自己跑 -3~+3 窗口\n",
    "sns.lineplot(data=event, x=\"rel_year\", y=\"coef\", marker=\"o\")\n",
    "plt.axhline(0, ls='--', c='grey')\n",
    "plt.title(\"Dynamic Effect: Risk Shock on Tobin's Q\")\n",
    "plt.savefig(\"figs/event_study.png\", dpi=300)\n",
    "\n",
    "# 3. 敏感性：不同分词器\n",
    "tbl = pd.read_csv(\"outputs/sensitivity.csv\")\n",
    "sns.barplot(data=tbl, x=\"tokenizer\", y=\"coef_change\")\n",
    "plt.title(\"Sensitivity: Tokenizer Choice\")\n",
    "plt.savefig(\"figs/sens_tokenizer.png\", dpi=300)\n"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
